{include file='public/meta'}
<title>添加角色</title>
{css href='/static/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css'}
</head>
<style type="text/css">
  form>div{margin:20px 0;}
  .row{margin-right:60px;}
</style>
<body>
	<form action="javascript:;" enctype="multipart/form-data" method="post">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>标题：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" placeholder="输入标题" name="title" value="" required>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>链接：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" placeholder="输入链接" name="link" value="" required>
			</div>
		</div>
		<div class="row cl">
      <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>图片：</label>
      <div class="formControls col-xs-8 col-sm-9">
        <div class="uploader-thum-container">
          <input type="file" name="thumb" class="input-text" required>
        </div>
      </div>
    </div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<button class="btn btn-primary radius" id="submit" type="submit"><i class="Hui-iconfont">&#xe632;</i> 添加</button>
			</div>
		</div>
	</form>
{include file='public/footer'}
  <script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
  <script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
  <script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/messages_zh.js"></script> 
  <script type="text/javascript" src="/static/lib/webuploader/0.1.5/webuploader.min.js"></script> 
  <script type="text/javascript" src="/static/lib/ueditor/1.4.3/ueditor.config.js"></script>
  <script type="text/javascript" src="/static/lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
  <script type="text/javascript" src="/static/lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
	$().ready(function(){
  	$('form').validate({
      rules:{

      },
  		messages:{

      },
  		submitHandler:function(form){
        $(form).ajaxSubmit({
          type:'post',
          url:'{:url('admin/system/lunbo_doadd')}',
          dataType:'text',
          success:function(res){
            res = eval('('+res+')');
            console.log(res.msg);
            if(res.msg == '成功'){
							layer.msg('添加成功',{icon:1,time:1500},function(){
								var index = parent.layer.getFrameIndex(window.name); 
								parent.layer.close(index);
							});
						}else{
              layer.msg(res.msg,{icon:1,time:1500});
            }
          }
  			})
  		}
  	});
  })

</script>
</body>
</html>